{%- block doctype -%}<!DOCTYPE html>{%- endblock %}

{%- set url_root = pathto('', 1) %}

{%- if url_root == '#' %}
  {% set url_root = '' %}
{% endif %}

{%- if not embedded and docstitle %}
  {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
{%- else %}
  {%- set titlesuffix = "" %}
{%- endif %}

{%- macro css() %} 
  <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
  <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
  <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
  {%- for cssfile in css_files %}
  <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
  {%- endfor %}
{%- endmacro %}

{%- macro script() %}
  <script type="text/javascript">
    var DOCUMENTATION_OPTIONS = {
      URL_ROOT:    '{{ url_root }}',
      VERSION:     '{{ release|e }}',
      COLLAPSE_INDEX: false,
      FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
      HAS_SOURCE:  {{ has_source|lower }},
      SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
    };
  </script>
  {%- for scriptfile in script_files %}
    <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
  {%- endfor %}    
  <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script>
    $(document).ready(function(){
      $('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click(function(event) {
        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
            var target = $(this.hash);
            target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
          if (target.length) {
            event.preventDefault();
            $('html, body').animate({
              scrollTop: target.offset().top - 80
            }, 1000, function() {
              var $target = $(target);
                $target.focus();
              if ($target.is(":focus")) { // Checking if the target was focused
              return false;
              } else {
                $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
                $target.focus(); // Set focus again
              };
            });
          }
        }
      });
      $(window).scroll(function () {
        if ($(this).scrollTop() > 50) {
          $('#back-to-top').fadeIn();
        } else {
          $('#back-to-top').fadeOut();
        }
      });
      $('#back-to-top').click(function () {
        $('body,html').animate({
          scrollTop: 0
        }, 800);
        return false;
      });
    });
  </script>
{%- endmacro %}

{%- macro relbar() %} 
  <nav class="navbar navbar-default navbar-fixed-top" id="navigation">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>                        
        </button>
        {%- if theme_show_fossasia_logo|lower == "true" %}
        <a class="navbar-brand" href="#"><img class="img-responsive" src="http://fossasia.org/img/fossasia-dark.png" style="width: 50%" /></a>
        {%- endif %}
      </div>
      <div class="collapse navbar-collapse" id="myNavbar">
        <ul class="nav navbar-nav navbar-right menu">
              {% if theme_link_about %}
              <li><a href={{ theme_link_about }}>About</a></li>
              {% endif %}
              {% if theme_link_docs %}
              <li><a href={{ theme_link_docs }}>Docs</a></li>
              {% endif %}
              {% if theme_link_blog %}
              <li><a href={{ theme_link_blog }}>Blog</a></li>
              {% endif %}
              {% if theme_link_donate %}
              <li><a href={{ theme_link_donate }}>Donate</a></li>
              {% endif %}
              {% if theme_link_contact %}
              <li><a href={{ theme_link_contact }}>Contact</a></li>
              {% endif %}
              {% if theme_link_twitter %}
              <li class="social-link hidden-md hidden-sm hidden-xs"><a href={{ theme_link_twitter }}><i class="fa fa-twitter fa-lg"></i></a></li>
              {% endif %}
              {% if theme_link_facebook %}
              <li class="social-link hidden-md hidden-sm hidden-xs"><a href={{ theme_link_facebook }}><i class="fa fa-facebook fa-lg"></i></a></li>
              {% endif %}
          </ul>
      </div>
    </div>
  </nav>
{%- endmacro %}

{%- macro sidebar() %}
  <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
    <div class="sphinxsidebarwrapper">
      {%- block sidebarlogo %}
      {%- if logo %}
        <p class="logo"><a href="{{ pathto(master_doc) }}">
          <img class="logo img-responsive" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo" style="width: 100%" />
        </a></p>
      {%- endif %}
      {%- endblock %}

      {%- if sidebars != None %}
        {#- new style sidebar: explicitly include/exclude templates #}
        {%- for sidebartemplate in sidebars %}
        {%- include sidebartemplate %}
        {%- endfor %}
      {%- else %}
        {#- old style sidebars: using blocks -- should be deprecated #}
        {%- block sidebarsearch %}
        {%- include "searchbox.html" %}
        {%- endblock %}
        {%- block sidebartoc %}
        {%- include "localtoc.html" %}
        {%- endblock %}
        {%- block sidebarrel %}
        {%- include "relations.html" %}
        {%- endblock %}
        {%- block sidebarsourcelink %}
        {%- include "sourcelink.html" %}
        {%- endblock %}
        {%- if customsidebar %}
        {%- include customsidebar %}
        {%- endif %}
      {%- endif %}
    </div>
  </div>
{%- endmacro %}

{%- macro extrafooter() %}
    <div class="row">
      <div class="col-sm-2">
        <ul class="menu">
        <li><a target="_self" href="http://blog.fossasia.org">Blog</a></li>
        <li><a target="_self" href="http://github.com/fossasia">Github</a></li>
        <li><a target="_self" href="http://labs.fossasia.org/#projects">Projects</a></li>
        <li><a target="_self" href="http://coc.fossasia.org/">Code of Conduct</a></li>
        <li><a target="_self" href="./about">About</a></li>
        <li><a target="_self" href="http://blog.fossasia.org/contact">Contact</a></li>
        <li><a target="_self" href="./donate/">Donate</a></li>
        <li><a class="inner-link" id="back-to-top" href="#top">Back To Top</a></li>
      </ul>
      </div>
      <div class="col-sm-7">
        <span class="lead color-heading">About FOSSASIA</span>
      <p>
FOSSASIA is the premier Free and Open Source technology organization in Asia for developers, designers, start-ups, and contributors. Projects at FOSSASIA range from open hardware, to design, graphics and software. FOSSASIA was established in 2009. The annual FOSSASIA Summit took place in Cambodia, Vietnam and Singapore. FOSSASIA meetup groups exist throughout Asia.</p>
      </div>
      <div class="col-sm-3">
        <ul class="contact-methods">
        <li><i class="fa fa-envelope fa-lg"></i><span><a id="mailAdd" href="mailto:fossasia@googlegroups.com" target="_self" style="color:#777777">&nbsp;fossasia@googlegroups.com</a></span></li>
        <li><i class="fa fa-mobile fa-lg"></i><span>&nbsp;+65 83435672</span></li>
        <li><i class="fa fa-map-marker fa-lg"></i><span>&nbsp;Ms. DANG Hong Phuc</span></li>
        <li><span>FOSSASIA</span></li>
        <li><span>Xoai Building, 93 Mau Than Street Xuan Khan, Ninh Kieu 9000 Can Tho, Vietnam</span></li>
      </ul>
      </div>
    </div>
    <div class="row">
      <div class="col-sm-12 text-center">
      <ul class="social-profiles">
        <li><a target="_self" href="http://twitter.com/fossasia"><i class="fa fa-twitter"></i></a></li>
        <li><a target="_self" href="http://facebook.com/fossasia"><i class="fa fa-facebook"></i></a></li>
        <li><a target="_self" href="https://www.linkedin.com/groups/FOSSASIA-3762811"><i class="fa fa-linkedin fa-lg"></i></a></li>
        <li><a target="_self" href="https://www.youtube.com/channel/UCQprMsG-raCIMlBudm20iLQ"><i class="fa fa-youtube icon-large"></i></a></li>
        <li><a target="_self" href="https://www.flickr.com/photos/fossasia"><i class="fa fa-flickr fa-lg"></i></a></li>
        <li><a target="_self" href="https://www.instagram.com/explore/tags/fossasia/"><i class="fa fa-instagram"></i></a></li>
        <li><a target="_self" href="https://github.com/fossasia"><i class="fa fa-github fa-lg"></i></a></li>
      </ul>
      </div>
    </div>
{%- endmacro %}

{%- if html_tag %}
{{ html_tag }}
{%- else %}
<html xmlns="http://www.w3.org/1999/xhtml"{% if language is not none %} lang="{{ language }}"{% endif %}>
{%- endif %}
  <head>
    {%- if use_meta_charset %}
    <meta charset="{{ encoding }}" />
    {%- else %}
    <meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" />
    {%- endif %}
    {{- metatags }}

    {%- block htmltitle %}
    <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
    {%- endblock %}

    {%- block csss %}
    {{- css() }}
    {%- endblock %}

    {%- if not embedded %}

    {%- block scripts %}
    {{- script() }}
    {%- endblock %}

    {%- if use_opensearch %}
    <link rel="search" type="application/opensearchdescription+xml"
          title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
          href="{{ pathto('_static/opensearch.xml', 1) }}"/>
    {%- endif %}

    {%- if favicon %}
    <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
    {%- endif %}

    {%- endif %}

    {%- block linktags %}
    {%- if hasdoc('about') %}
    <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
    {%- endif %}

    {%- if hasdoc('genindex') %}
    <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
    {%- endif %}

    {%- if hasdoc('search') %}
    <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
    {%- endif %}

    {%- if hasdoc('copyright') %}
    <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
    {%- endif %}

    {%- if next %}
    <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
    {%- endif %}

    {%- if prev %}
    <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
    {%- endif %}
    {%- endblock %}

    {%- block extrahead %} {% endblock %}
  </head>
  <body>
    <div class="container-fluid main">
      {%- block header %}{% endblock %}
      {%- block relbar1 %}{{ relbar() }}{% endblock %}
      {%- block content %}
      <div class="container">
        <div class="col-md-3 hidden-sm hidden-xs">
          {%- block sidebar1 %} {{ sidebar() }} {% endblock %}
        </div>
        <div class="document col-md-9"> <!-- Document -->
          {%- block document %}
          <div> <!-- Document Wrapper -->
            <div class="body" role="main"> <!-- Body-->
              {%- block body %} {% endblock %}
            </div>
          </div>
          {%- endblock %} 
        </div>
        {%- endblock %}
      </div>
      {%- block footer %}
      <div class="footer-container">
        <footer role="contentinfo" class="footer">
          <div class="container">
            {%- block extra_footer %}
            {{ extrafooter() }}
            {%- endblock %}
            <hr />
            <div class="copy">
              {%- if show_copyright %}
                {%- if hasdoc('copyright') %}
                  {%- trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">{{ copyright }}</a> {{ copyright}}.{% endtrans %}
                {%- else %}
                  {% trans copyright=copyright|e %}&copy; {{ copyright }}. All Rights Reserved.{% endtrans %}
                {%- endif %}
              {%- endif %}
              {%- if last_updated %}
                {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
              {%- endif %}
              {%- if show_sphinx %}
                {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
              {%- endif %}
            </div>
          </div>
        </footer>
      </div>
      {%- endblock %}
    </div>
  </body>
</html>
